const INFO          = 'info_98035361f008780a0428ere98385c78b4ff801';
const THEME         = 'theme_98035361f0087800428ere98385c78b4ff801';

export const Token = {
    set: (key, val)         => localStorage.setItem(key, val),
    get: key                => localStorage.getItem(key),
    remove: key             => localStorage.removeItem(key),
    setJSON: (key, json)    => Token.set(key, JSON.stringify(json)),
    getJSON: key            => JSON.parse(Token.get(key)) || {},
    getInfo: ()             => Token.getJSON(INFO),
    setInfo: info           => Token.setJSON(INFO, info),
    isActive: ()            => !_.isEmpty(Token.getUserId()),
    getTheme: ()            => Token.getJSON(THEME),
    setTheme: t             => Token.setJSON(THEME, t),
    getAppId: ()            => Token.getJSON(INFO).appId,
    getUserId: ()           => Token.getJSON(INFO).userId,
    setMid:(mid)=>{localStorage.setItem('mid',mid)},
    getMid:()=>localStorage.getItem('mid')
};
